home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / zaxe1.zip / HOWPATCH.TXT < prev    next >
Text File  |  1996-08-14  |  8KB  |  172 lines

  1. How to use and make QuakeC patch files
  2. by Jeff Epler <jepler@inetnebr.com>
  3. 3 August 1996
  4.  
  5. This is a draft, and probably isn't that great an explanation.  Please
  6. mail me with questions about the directions, or suggestions on how to
  7. improve this document.
  8.  
  9. Some parts of this document were contributed by Kyle R. Hofmann
  10. <rhofmann@crl.com>, and various other changes were also suggested via email.
  11.  
  12. You should always be able to find the newest version of this
  13. document at http://cse.unl.edu/~jepler/quakec/howpatch.txt.  If I
  14. take the time to make a hypertext version of this file, it will be at
  15. http://cse.unl.edu/~jepler/quakec/howpatch.html.  This file is also
  16. uploaded to ftp.cdrom.com.
  17.  
  18. How to use QuakeC patch files
  19. -----------------------------
  20.  
  21.    Get and install a version of patch suitable for your OS.  Under most
  22.    unicies, (including Linux) this is already available.  For DOS, you
  23.    want
  24.     ftp://oak.oakland.edu/pub/simtelnet/gnu/djgpp/v2gnu/pat21b.zip
  25.     ftp://ftp.simtelnet.com/pub/simtelnet/gnu/djgpp/v2gnu/pat21b.zip
  26.    I don't know where a windows 95/nt version of patch resides, but the
  27.    DOS version should execute just fine.  If you want to compile your own
  28.    version of patch, get it from
  29.      ftp://prep.ai.mit.edu/pub/gnu/diffutils-2.7.tar.gz
  30.  
  31.    Get a version of qcc suitable for your OS.  Look around at
  32.     ftp://ftp.cdrom.com/pub/idgames/idstuff/source or
  33.     ftp://ftp.cdrom.com/pub/idgames2/quakec or
  34.     ftp://ftp.cdrom.com/pub/idgames2/utils for one.
  35.  
  36.    Get a patch file.  One such file will reside at
  37.     ftp://ftp.cdrom.com/pub/idgames2/quakec/monsters/friend.zip
  38.    Unzip it, and you'll get friend.pat.
  39.  
  40.    Put the patch.exe and qccdos.exe files in a directory in your PATH.
  41.  
  42.    Make a new directory and copy the unchanged files from v101qc to this
  43.    new directory.  Change to the new directory.  Unzip the patch file
  44.    (friend.zip) here, or move it from where you unzipped it. (If you are
  45.    smart or willing to spend much time, you can add several patches to
  46.    the same source, getting all the features.  However, there are likely
  47.    to be rejects [see below] or unwanted side effects of putting several
  48.    patches together)
  49.  
  50.      patch < friend.pat or
  51.      type friend.pat | patch
  52.  
  53.    Inspect the directory for any "rejected" patches.  If there are some,
  54.    you should use your favorite editor to inspect the reject file (named
  55.    under unix whatever.qc.rej, and under DOS whatever.qc#) and make by
  56.    hand the changes that are required.  + marks lines present in the
  57.    new version but not in the old, and - marks lines present in the old
  58.    but not in the new.  Ideally, you should have no rejected patches.
  59.    If you have many rejected patches, your command-line may have been
  60.    wrong for patch.  Files ending in ~ are backups of files changed by the
  61.    patch, and can generally be deleted.
  62.  
  63.    Run qcc to compile a new progs.dat (depending on the setup, progs.dat
  64.    may be created in the current directory or the parent directory.
  65.    Change the first line in progs.src to move where progs.dat will be
  66.    created), copy it to quake\whatever, and run quake -game whatever.
  67.    You're done.
  68.  
  69.    To undo a patch, use the command
  70.  
  71.      patch -R < friend.pat
  72.  
  73.    Make sure you type an uppercase R.
  74.  
  75. Errors installing QuakeC patches
  76. --------------------------------
  77.  
  78.   patch is not a perfect utility.  If the QuakeC source which you are
  79. trying to patch is already modified, or if the file has had lines added
  80. or subtracted to it, you may get errors.  In serious cases, you may get
  81. "rejected hunks", patches which could not be applied at all.  Warning and
  82. errors include:
  83.  
  84.   - Offsets.  Offsets are nothing much to be concerned about, usually.
  85.     They indicate that patch did not place the patch on the exact line
  86.     specified; instead, patch placed the patch several lines away.  This
  87.     is usually indicative of previously changed QuakeC sources, and in
  88.     most cases may be safely ignored.  However, if there is an
  89.     excessively large offset, you should check to make sure the patch has
  90.     been applied properly.
  91.  
  92.   - Fuzz factor.  Fuzz factor indicates that the exact context could not
  93.     be found, and so context lines at the beginning or end of the patch
  94.     were ignored.  Be suspicious of patches which have a fuzz factor.
  95.     Though they may be a result of changed sources, they can also be a
  96.     result of an improperly applied or created patch.  Be sure to check
  97.     to ensure that the patch is properly applied.
  98.  
  99.   - Rejected hunks.  Rejected hunks are sections of a patch which could
  100.     not be applied at all.  They will be named foo.qc.rej or foo.qc#
  101.     (replace foo with the filename of the .qc file which could not be
  102.     patched).  They may be hand applied by going to the lines specified
  103.     at the start of the hunk and the entire hunk being copied in.  If the
  104.     hunk is part of a context diff, be sure to install the second half;
  105.     that's the changed version (you can use the first half of the hunk
  106.     to determine where the patch should be applied).  If the hunk is part
  107.     of a unified diff, be sure to remove the sections with as - prefixing
  108.     them and remove the + prefixing other lines (but do not remove the
  109.     lines with the +'s)  However, be *extremely careful* --- rejected
  110.     hunks may be completely incompatible with the code you currently have
  111.     installed.
  112.  
  113. Installing multiple patch files
  114. -------------------------------
  115.  
  116.    Installing multiple patch files is easy and simple.  Simply get both
  117.    patches, and install them using the procedure listed above.  You will
  118.    most likely encounter some of the errors listed above.  In this case, do
  119.    not worry if it's simply a case of a minor offset.  Most likely the file
  120.    has been modified by both patches and you're seeing a side effect.  Worry
  121.    more if a fuzz factor is needed; it might indicate that the same portion
  122.    of code is being modified by two patches.  Worry most when a hunk is
  123.    rejected --- that usually indicates that the exact same portion of code
  124.    was modified by both patches.  It might make the two incompatible.
  125.  
  126.  
  127. How to make QuakeC patch files
  128. ------------------------------
  129.  
  130.    Get and install a copy of diff for your machine.  For unix, again it's
  131.    included.  For DOS, get
  132.     ftp://oak.oakland.edu/pub/simtelnet/gnu/djgpp/v2gnu/dif271b.zip
  133.     ftp://ftp.simtelnet.com/pub/simtelnet/gnu/djgpp/v2gnu/dif271b.zip
  134.    Again, I don't know about w95/w32/wnt, except that the dos version
  135.    should work in the dos box.
  136.  
  137.    Get a directory with your mods in it and a directory with v101qc source
  138.    side by side.
  139.  
  140.    diff -ur --new-file v101qc yourdir > yourdir.pat
  141.  
  142.    zip or otherwise compress yourdir.pat
  143.  
  144.    Share with the world.
  145.  
  146.    You should probably always diff against v101qc sources unless you have
  147.    a good reason not to.  When you diff against v101qc, anyone can use
  148.    those files and your .pat file to get a replica of your sources.  One
  149.    time to use a different set of 'old' files would be something like this:
  150.  
  151.      John Doe made code for a weapon that turned monsters into little dogs.
  152.      The only problem is that his files don't quite work -- Ammo can be
  153.      turned into a dog too.  You fix this up and want to let John know.  So
  154.      you make a diff like this:
  155.  
  156.      diff -ur --new-file jdgun yourgun > yourgun.pat
  157.  
  158.      Now, John Doe can see the differences between his gun code and your
  159.      gun code, and as a bonus the file is smaller.  You could also hand it
  160.      out to people who have his original gun diff as well.
  161.  
  162. Other problems
  163. --------------
  164.  
  165. If you get an error about being unable to create a file /tmp/paaaax
  166. (For instance), just create a \TMP directory on the drive where you were
  167. trying to run patch.  I don't know if having the TEMP or TMP environment
  168. variable set to an existing directory will also help this.
  169.  
  170. If you get an error about DPMI, copy cwsdpmi.exe from the quake directory 
  171. onto your path.
  172.